﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CompanyBussiness;

namespace Website
{
    public partial class Help : System.Web.UI.Page
    {
        System.Web.UI.Control ct;
        HtmlGenericControl genControl;
        string modulCode = "MNEWS";
        NewsManagement newsMana = new NewsManagement();
        LanguagesManagement languageMana = new LanguagesManagement();
        CompanyBussiness.Language language;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies[CONST.COOKIES_LANGUAGE] != null)
            {

                language = languageMana.GetLanguageByID(int.Parse(Request.Cookies[CONST.COOKIES_LANGUAGE][CONST.COOKIES_LANGUAGE_ID].ToString()));
            }
            else
            {
                Response.Redirect("~/Hem.html");
            }


            PlaceHolderMenuMain.Controls.Clear();
            genControl = new HtmlGenericControl("div");
            ct = Page.LoadControl("customer/Control/cMenuMain.ascx");
            genControl.Controls.Add(ct);
            PlaceHolderMenuMain.Controls.Add(genControl);

            PlaceHolderMenuLeft.Controls.Clear();
            genControl = new HtmlGenericControl("div");
            ct = Page.LoadControl("customer/Control/cMenuCategory.ascx");
            genControl.Controls.Add(ct);
            PlaceHolderMenuLeft.Controls.Add(genControl);

            if (Request[CONST.QUERYSTRING_NEWS] != null)
            {
                PlaceHolderCenter.Controls.Clear();
                genControl = new HtmlGenericControl("div");
                ct = Page.LoadControl("customer/Control/cDetailNews.ascx");
                genControl.Controls.Add(ct);
                PlaceHolderCenter.Controls.Add(genControl);
            }
            else
            {
                PlaceHolderCenter.Controls.Clear();
                genControl = new HtmlGenericControl("div");
                ct = Page.LoadControl("customer/Control/cListNewsByCategory.ascx");
                genControl.Controls.Add(ct);
                PlaceHolderCenter.Controls.Add(genControl);
            }
        }
    }
}